<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      .play-button {
        background-color: lightblue;
        cursor: pointer;
        height: 100px;
        width: 200px;
      }
    </style>
  </head>
  <body>
    <div class="play-button">点击打开标签页</div>
    <script src="./channel.js"></script>
    <script>
      const playButton = document.querySelector(".play-button");
      const channel = createChannel("music");
      playButton.addEventListener("click", (e) => {
        if (channel.listeners.size === 0) {
          window.open(`./music.html`, "_blank");
        } else {
          channel.postMessage({
            musicName: "男人好难",
          });
        }
      });
    </script>
  </body>
</html>
